<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>星梦小铺后台管理系统</title>
    <!-- Bootstrap -->
    <link href="../css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="../css/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <!-- NProgress -->
    <link href="../css/nprogress/nprogress.css" rel="stylesheet">
    <!-- Custom Theme Style -->
    <link href="../css/custom.min.css" rel="stylesheet">
    <script type="text/javascript" src="../js/jquery-1.12.4.js"></script>
</head>

<body class="nav-md">
	<div class="container body">
		<div class="main_container">
			<%@include file="header.jsp"%>
			<!-- page content -->
			<div class="right_col" role="main">
				<div class="row">
					<div class="col-md-12 col-sm-12 col-xs-12">
						<div class="x_panel">
							<div class="x_title">
								<h2>
									新增商品信息 <i class="fa fa-user"></i><small>当前操作用户：</small>
								</h2>
								<div class="clearfix"></div>
							</div>
							<div class="x_content">
								<div class="clearfix"></div>
								<form class="form-horizontal form-label-left" enctype="multipart/form-data" action="shop?action=shopadd" method="post">
									<div class="item form-group">
										<label class="control-label col-md-3 col-sm-3 col-xs-12"
											for="ntitle">商品名称<span class="required">*</span>
										</label>
										<div class="col-md-6 col-sm-6 col-xs-12">
											<input id="shopname"
												class="form-control col-md-7 col-xs-12"
												data-validate-length-range="20" data-validate-words="1"
												name="shopname" required="required"
												placeholder="请输入商品标题" type="text">
										</div>
									</div>
									
									<div class="item form-group">
										<label class="control-label col-md-3 col-sm-3 col-xs-12"
											for="ntid">商品类型<span class="required">*</span>
										</label>
										<div class="col-md-6 col-sm-6 col-xs-12">
										    <select id="type" name="type" class="form-control col-md-7 col-xs-12">
										      <option value="0" selected>--默认--</option>
										    </select>
										    <script type="text/javascript">
										    $(function(){
							                   $.getJSON("type",function(typelist){	
				                                //用于将符合标准格式的的JSON字符串转为与之对应的JavaScript对象			  
				                                //var flalist=$.parseJSON(result);
				                                 for(var i in typelist){
				                                    $("#type").append("<option  value=\""+typelist[i].typeid+"\">"+typelist[i].type+"</option>");
				                                     /* $("#flav").append("1"); */
				                                    }
				                                 });
										         });
							                 </script>
										</div>
									</div>
									<div class="item form-group">
										<label class="control-label col-md-3 col-sm-3 col-xs-12"
											for="ntid">商品种类<span class="required">*</span>
										</label>
										<div class="col-md-6 col-sm-6 col-xs-12">
										    <select id="kind" name="kind" class="form-control col-md-7 col-xs-12">
										       <option value="0" >--默认--</option>
										    </select>
										</div>
									</div>
									<script type="text/javascript">
								$("#type").change(function(){
									$("#kind").html("");
									$.getJSON("kind",{"typeid":$(this).val()},function(kindlist){	
						                   //用于将符合标准格式的的JSON字符串转为与之对应的JavaScript对象			  
						                   //var flalist=$.parseJSON(result);
						                    $("#kind").append("<option value=\"0\">--默认--</option>");
						                    for(var i in kindlist){
						                       $("#kind").append("<option value=\""+kindlist[i].kindid+"\">"+kindlist[i].kind+"</option>");
						                        /* $("#flav").append("1"); */
						                        }
						                     });
								})
							
							
							</script>
							         <div class="item form-group">
										<label class="control-label col-md-3 col-sm-3 col-xs-12"
											for="ntid">商品品牌<span class="required">*</span>
										</label>
										<div class="col-md-6 col-sm-6 col-xs-12">
										    <select id="brand" name="brand" class="form-control col-md-7 col-xs-12">
										       <option value="0" >--默认--</option>
										    </select>
										</div>
									</div>
									 <script type="text/javascript">
										    $(function(){
							                   $.getJSON("brand",function(brandlist){	
				                                //用于将符合标准格式的的JSON字符串转为与之对应的JavaScript对象			  
				                                //var flalist=$.parseJSON(result);
				                                 for(var i in brandlist){
				                                    $("#brand").append("<option  value=\""+brandlist[i].brandid+"\">"+brandlist[i].brand+"</option>");
				                                     /* $("#flav").append("1"); */
				                                    }
				                                 });
										         });
							                 </script>
									<div class="item form-group">
										<label class="control-label col-md-3 col-sm-3 col-xs-12"
											for="ntid">商品口味<span class="required">*</span>
										</label>
										<div id="flav" class="col-md-6 col-sm-6 col-xs-12">
										</div>
									</div>
									<script type="text/javascript">
				               $.getJSON("flavour",function(flalist){	
				                   //用于将符合标准格式的的JSON字符串转为与之对应的JavaScript对象			  
				                   //var flalist=$.parseJSON(result);
				                    for(var i in flalist){
				                       $("#flav").append("<label><input name=\"flav\" type=\"checkbox\" value=\""+flalist[i].flavid+"\" />"+flalist[i].flavour+" </label>");
				                        /* $("#flav").append("1"); */
				                        }
				                     });
				                        </script>
									<div class="item form-group">
										<label class="control-label col-md-3 col-sm-3 col-xs-12"
											for="ncontent">商品描述<span class="required">*</span>
										</label>
										<div class="col-md-6 col-sm-6 col-xs-12">
										    <textarea id="describe" name="describe" rows="5" cols="20"
										    class="form-control col-md-7 col-xs-12"></textarea> 
										</div>
									</div>
									<div class="item form-group">
										<label class="control-label col-md-3 col-sm-3 col-xs-12"
											for="newsimg">商品图片<span class="required">*</span>
										</label>
										<div class="col-md-6 col-sm-6 col-xs-12">
											<input id="shopimg" name="shopimg" type="file" class="form-control col-md-7 col-xs-12">
										</div>
									</div>
									<div class="item form-group">
										<label class="control-label col-md-3 col-sm-3 col-xs-12"
											for="ntitle">商品库存<span class="required">*</span>
										</label>
										<div class="col-md-6 col-sm-6 col-xs-12">
											<input id="kucun"
												class="form-control col-md-7 col-xs-12"
												data-validate-length-range="20" data-validate-words="1"
												name="kucun" required="required"
												placeholder="请输入商品库存" type="text">
										</div>
									</div>
									<div class="ln_solid"></div>
									<div class="form-group">
										<div class="col-md-6 col-md-offset-3">
											<button id="send" type="submit" class="btn btn-success">保存</button>
											<button type="button" class="btn btn-primary" id="back">返回</button>
											<br />
											<br />
										</div>
									</div>
								</form>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!-- /page content -->

		<!-- footer content -->
		<footer>
			<div class="pull-right">&copy;明晟科技</div>
			<div class="clearfix"></div>
		</footer>
		<!-- /footer content -->
	</div>

	<!-- jQuery -->
	<script src="../js/jquery-1.12.4.js"></script>
	<!-- Bootstrap -->
	<script src="../js/bootstrap.min.js"></script>
	<!-- FastClick -->
	<script src="../js/fastclick.js"></script>
	<!-- NProgress -->
	<script src="../css/nprogress/nprogress.js"></script>

	<!-- Custom Theme Scripts -->
	<script src="../js/custom.min.js"></script>
</body>
</html>